/**
 * File:   modbus_server_view_model.h
 * Author: AWTK Develop Team
 * Brief:  modbus_server_view_model
 *
 * Copyright (c) 2023 - 2024  Guangzhou ZHIYUAN Electronics Co.,Ltd.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * License file for more details.
 *
 */

/**
 * History:
 * ================================================================
 * 2024-3-11 Li XianJing <xianjimli@hotmail.com> created
 *
 */

#ifndef TK_MODBUS_SERVER_MODEL_H
#define TK_MODBUS_SERVER_MODEL_H

#include "tkc/object.h"
#include "conf_io/conf_node.h"
#include "modbus_prop.h"
#include "modbus_server_channel.h"

BEGIN_C_DECLS

/**
 * @class modbus_server_view_model_t
 * @annotation ["fake"]
 * modbus_server_view_model
 * 
*/

/**
 * @method modbus_server_view_model_init
 * 初始化。
 *
 * @return {ret_t} 返回RET_OK表示成功，否则表示失败。
 */
ret_t modbus_server_view_model_init(void);

/**
 * @method modbus_server_view_model_deinit
 * 反初始化。
 *
 * @return {ret_t} 返回RET_OK表示成功，否则表示失败。
 */
ret_t modbus_server_view_model_deinit(void);

#define MODBUS_SERVER_MODEL_PROP_URL "url"
#define MODBUS_SERVER_MODEL_PROP_UNIT_ID "unit_id"

/**
 * @method modbus_server_view_model_create
 * 创建modbus_server_view_model对象。
 *
 * @annotation ["constructor"]
 * @return {tk_object_t*} 返回modbus_server_view_model对象。
 */
tk_object_t* modbus_server_view_model_create_with_name(const char* name);

/**
 * @method modbus_server_view_model_parse_prop
 * 解析属性名。
 * @param {tk_object_t*} obj 对象。
 * @param {const char*} name 属性名。
 * @param {modbus_prop_t*} prop 属性名信息。
 * @return {ret_t} 返回RET_OK表示成功，否则表示失败。
 */ 
ret_t modbus_server_view_model_parse_prop(tk_object_t* obj, const char* name,
                                                modbus_prop_t* prop);
END_C_DECLS

#endif /*TK_MODBUS_SERVER_MODEL_H*/

